function controlNumeric(ctrl, err)
{
    var r = /^[0-9]+$/;
    if(r.test(ctrl.value) || ctrl.value.length == 0)
    {
        err.innerHTML = '';
    }
    else
    {
        err.innerHTML = '<font color="red">Must be numeric</font>';
    }
}

function controlPassword(ctrl, err)
{
    var r = /^[0-9a-zA-Z\_]+$/;
    if(ctrl.value.length == 0)
    {
	err.innerHTML = '';
    }
    else if(ctrl.value.length < 5)
    {
	err.innerHTML = '<font color="red">Unsafe password</font>';
    }
    else if(r.test(ctrl.value))
    {
	err.innerHTML = '<font color="green"><b>OK</b></font>';
    }
    else
    {
	err.innerHTML = '<font color="red">Wrong password</font>';
    }
}

function controlPassword2(ctrl, pass1, err)
{
    if(ctrl.value.length == 0)
    {
	err.innerHTML = '';
    }
    else if(ctrl.value != pass1.value && ctrl.value.length > 0)
    {
	err.innerHTML = '<font color="red">Password mismatch</font>';
    }
    else
    {
	err.innerHTML = '<font color="green"><b>OK</b></font>';
    }
}

function enableSubmit()
{
    var submit = document.getElementById("submit");
    submit.disabled = false;
}

function disableSubmit()
{
    var submit = document.getElementById("submit");
    submit.disabled = true;
}